<?php declare(strict_types=1);
/**
 * This file is part of Swoft.
 *
 * @link     https://swoft.org
 * @document https://swoft.org/docs
 * @contact  group@swoft.org
 * @license  https://github.com/swoft-cloud/swoft/blob/master/LICENSE
 */

namespace App\Http\Controller\User;


use Swoft\Co;
use Swoft\Http\Server\Annotation\Mapping\Middleware;
use Swoft\Http\Server\Annotation\Mapping\Middlewares;
use Swoft\Http\Server\Annotation\Mapping\Controller;
use Swoft\Http\Server\Annotation\Mapping\RequestMapping;
use Swoft\Http\Server\Bean\Annotation\RequestMethod;

use App\Model\Logic\UserLogic;
use App\Http\Middleware\UserMiddleware;   // 

/**
 * Class UserController
 *
 * @since 2.0
 *
 * @Controller(prefix="user/user", middleware=UserMiddleware::class)
 * 
 * @uses UserMiddleware::class
 * 
 */
class UserController
{
    /**
     * @RequestMapping("getList")
     * @Middleware(UserMiddleware::class)
     * @return array
     */
    public function getUserList(): array
    {
        $b = UserLogic::getUserList();
        $id = Co::id();
        $gid = getmygid();
        $uid = getmyuid();
        $pid = getmypid();
        $user = get_current_user();
        $arr = [ 
            $gid,  
            $uid, 
            $pid, 
            $user, 
            // \gc_status(),
            // \get_defined_constants()
        ];
        return $arr;
        return [$arr, $b, $id];
    }


    /**
     * @RequestMapping("getBrief")
     * @return array
     */
    public function getUserBrief(): array
    {
        $id = Co::id();

        return [$id];
    }

}
